﻿using Volo.Abp.Domain.Entities.Auditing;

namespace FlyingEye.Devices
{
    /// <summary>
    /// id = 设备机台 ID
    /// </summary>
    public class DeviceClientModel : AuditedEntity<string>, IPropertyLoader
    {
#pragma warning disable CS8618 // 在退出构造函数时，不可为 null 的字段必须包含非 null 值。请考虑声明为可以为 null。
        public DeviceClientModel()
#pragma warning restore CS8618 // 在退出构造函数时，不可为 null 的字段必须包含非 null 值。请考虑声明为可以为 null。
        {
            // automapper 调用
        }

        public DeviceClientModel(
            string id,
            int site,
            string processName,
            Action<object, string> lazyLoader)
        {
            Id = id;
            Site = site;
            ProcessName = processName;
            LazyLoader = lazyLoader;
        }

        /// <summary>
        /// 基地
        /// </summary>
        public int Site { get; set; }

        /// <summary>
        /// 工序
        /// </summary>
        public string ProcessName { get; set; }

        private List<DeviceConfigurationModel> _deviceConfigurations = null!;

        public List<DeviceConfigurationModel> DeviceConfigurations
        {
            get => this.Load(ref _deviceConfigurations);
            set => _deviceConfigurations = value;
        }

        public Action<object, string> LazyLoader { get; }

    }
}
